import request from '@/utils/request'

export function getdeviceList(tid,productId, pageNum, pageSize) {
    return request({
      url: 'http://localhost:8080/device/page/'+tid,
      method: 'get',
      params: {
        productId,
        pageNum,
        pageSize
      }
    })
  }

  export function  getDeviceTypeList() {
    return request({
      url: 'http://localhost:8080/deviceType',
      method: 'get',
      params: {
      }
    })
  }


    export function  insertDevice(device) {
      return request({
        url: 'http://localhost:8080/device',
        method: 'post',
        data:device
      })
    }

    export function  delDevice(id) {
      return request({
        url: 'http://localhost:8080/device/'+id,
        method: 'delete'

      })
    }

    export function  getDetail(did) {
      return request({
        url: 'http://localhost:8080/deviceType/detail',
        method: 'get',
        params: {
          did
        }
      })
    }


    export function  getTopic(deviceKey) {
      return request({
        url: 'http://localhost:8080/deviceTopic/'+deviceKey,
        method: 'get',
      })
    } 

    export function  getNumber(currentProduct) {
      return request({
        url: 'http://localhost:8080/device/total',
        method: 'post',
        data:currentProduct
      })
    } 

    export function  getActiveNumber(currentProduct) {
      return request({
        url: 'http://localhost:8080/device/active',
        method: 'post',
        data:currentProduct
      })
    }
    
    export function  getCurrentDevice(did) {
      return request({
        url: 'http://localhost:8080/device/'+did,
        method: 'get',
      })
    }